home *** CD-ROM | disk | FTP | other *** search
/ Freelog 121 / FreelogMagazineJuilletAout2014-No121.iso / Outils / Adobe-Air / adobe-air_13.exe / [0] / setup.swf / scripts / mx / containers / Panel.as < prev    next >
Text File  |  2014-03-27  |  33KB  |  965 lines

  1. package mx.containers
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.display.Graphics;
  5.    import flash.events.Event;
  6.    import flash.events.MouseEvent;
  7.    import flash.geom.Rectangle;
  8.    import flash.text.TextLineMetrics;
  9.    import flash.utils.getQualifiedClassName;
  10.    import mx.automation.IAutomationObject;
  11.    import mx.containers.utilityClasses.BoxLayout;
  12.    import mx.containers.utilityClasses.CanvasLayout;
  13.    import mx.containers.utilityClasses.ConstraintColumn;
  14.    import mx.containers.utilityClasses.ConstraintRow;
  15.    import mx.containers.utilityClasses.IConstraintLayout;
  16.    import mx.containers.utilityClasses.Layout;
  17.    import mx.controls.Button;
  18.    import mx.core.Container;
  19.    import mx.core.ContainerLayout;
  20.    import mx.core.EdgeMetrics;
  21.    import mx.core.EventPriority;
  22.    import mx.core.FlexVersion;
  23.    import mx.core.IFlexDisplayObject;
  24.    import mx.core.IFlexModuleFactory;
  25.    import mx.core.IFontContextComponent;
  26.    import mx.core.IUIComponent;
  27.    import mx.core.IUITextField;
  28.    import mx.core.UIComponent;
  29.    import mx.core.UIComponentCachePolicy;
  30.    import mx.core.UITextField;
  31.    import mx.core.UITextFormat;
  32.    import mx.core.mx_internal;
  33.    import mx.effects.EffectManager;
  34.    import mx.events.CloseEvent;
  35.    import mx.styles.ISimpleStyleClient;
  36.    import mx.styles.IStyleClient;
  37.    import mx.styles.StyleProxy;
  38.    
  39.    use namespace mx_internal;
  40.    
  41.    public class Panel extends Container implements IConstraintLayout, IFontContextComponent
  42.    {
  43.       
  44.       mx_internal static var createAccessibilityImplementation:Function;
  45.       
  46.       private static var _closeButtonStyleFilters:Object = {
  47.          "closeButtonUpSkin":"closeButtonUpSkin",
  48.          "closeButtonOverSkin":"closeButtonOverSkin",
  49.          "closeButtonDownSkin":"closeButtonDownSkin",
  50.          "closeButtonDisabledSkin":"closeButtonDisabledSkin",
  51.          "closeButtonSkin":"closeButtonSkin",
  52.          "repeatDelay":"repeatDelay",
  53.          "repeatInterval":"repeatInterval"
  54.       };
  55.       
  56.       mx_internal static const VERSION:String = "3.0.0.0";
  57.       
  58.       private static const HEADER_PADDING:Number = 14;
  59.        
  60.       
  61.       private var layoutObject:Layout;
  62.       
  63.       private var _status:String = "";
  64.       
  65.       private var _titleChanged:Boolean = false;
  66.       
  67.       mx_internal var titleBarBackground:IFlexDisplayObject;
  68.       
  69.       private var regX:Number;
  70.       
  71.       private var regY:Number;
  72.       
  73.       private var _layout:String = "vertical";
  74.       
  75.       mx_internal var closeButton:Button;
  76.       
  77.       private var initializing:Boolean = true;
  78.       
  79.       private var _title:String = "";
  80.       
  81.       protected var titleTextField:IUITextField;
  82.       
  83.       private var _statusChanged:Boolean = false;
  84.       
  85.       private var autoSetRoundedCorners:Boolean;
  86.       
  87.       private var _titleIcon:Class;
  88.       
  89.       private var _constraintRows:Array;
  90.       
  91.       protected var controlBar:IUIComponent;
  92.       
  93.       mx_internal var titleIconObject:Object = null;
  94.       
  95.       protected var titleBar:UIComponent;
  96.       
  97.       private var panelViewMetrics:EdgeMetrics;
  98.       
  99.       private var _constraintColumns:Array;
  100.       
  101.       mx_internal var _showCloseButton:Boolean = false;
  102.       
  103.       private var checkedForAutoSetRoundedCorners:Boolean;
  104.       
  105.       private var _titleIconChanged:Boolean = false;
  106.       
  107.       protected var statusTextField:IUITextField;
  108.       
  109.       public function Panel()
  110.       {
  111.          _constraintColumns = [];
  112.          _constraintRows = [];
  113.          super();
  114.          addEventListener("resizeStart",EffectManager.eventHandler,false,EventPriority.EFFECT);
  115.          addEventListener("resizeEnd",EffectManager.eventHandler,false,EventPriority.EFFECT);
  116.          layoutObject = new BoxLayout();
  117.          layoutObject.target = this;
  118.          showInAutomationHierarchy = true;
  119.       }
  120.       
  121.       private function systemManager_mouseUpHandler(param1:MouseEvent) : void
  122.       {
  123.          if(!isNaN(regX))
  124.          {
  125.             stopDragging();
  126.          }
  127.       }
  128.       
  129.       mx_internal function getHeaderHeightProxy() : Number
  130.       {
  131.          return getHeaderHeight();
  132.       }
  133.       
  134.       override public function getChildIndex(param1:DisplayObject) : int
  135.       {
  136.          if(controlBar && param1 == controlBar)
  137.          {
  138.             return numChildren;
  139.          }
  140.          return super.getChildIndex(param1);
  141.       }
  142.       
  143.       mx_internal function get _controlBar() : IUIComponent
  144.       {
  145.          return controlBar;
  146.       }
  147.       
  148.       mx_internal function getTitleBar() : UIComponent
  149.       {
  150.          return titleBar;
  151.       }
  152.       
  153.       [Bindable("layoutChanged")]
  154.       public function get layout() : String
  155.       {
  156.          return _layout;
  157.       }
  158.       
  159.       override protected function createChildren() : void
  160.       {
  161.          var _loc1_:Class = null;
  162.          var _loc2_:IStyleClient = null;
  163.          var _loc3_:ISimpleStyleClient = null;
  164.          super.createChildren();
  165.          if(!titleBar)
  166.          {
  167.             titleBar = new UIComponent();
  168.             titleBar.visible = false;
  169.             titleBar.addEventListener(MouseEvent.MOUSE_DOWN,titleBar_mouseDownHandler);
  170.             rawChildren.addChild(titleBar);
  171.          }
  172.          if(!mx_internal::titleBarBackground)
  173.          {
  174.             _loc1_ = getStyle("titleBackgroundSkin");
  175.             if(_loc1_)
  176.             {
  177.                titleBarBackground = new _loc1_();
  178.                _loc2_ = mx_internal::titleBarBackground as IStyleClient;
  179.                if(_loc2_)
  180.                {
  181.                   _loc2_.setStyle("backgroundImage",undefined);
  182.                }
  183.                _loc3_ = mx_internal::titleBarBackground as ISimpleStyleClient;
  184.                if(_loc3_)
  185.                {
  186.                   _loc3_.styleName = this;
  187.                }
  188.                titleBar.addChild(DisplayObject(mx_internal::titleBarBackground));
  189.             }
  190.          }
  191.          createTitleTextField(-1);
  192.          createStatusTextField(-1);
  193.          if(!mx_internal::closeButton)
  194.          {
  195.             closeButton = new Button();
  196.             mx_internal::closeButton.styleName = new StyleProxy(this,closeButtonStyleFilters);
  197.             mx_internal::closeButton.upSkinName = "closeButtonUpSkin";
  198.             mx_internal::closeButton.overSkinName = "closeButtonOverSkin";
  199.             mx_internal::closeButton.downSkinName = "closeButtonDownSkin";
  200.             mx_internal::closeButton.disabledSkinName = "closeButtonDisabledSkin";
  201.             mx_internal::closeButton.skinName = "closeButtonSkin";
  202.             mx_internal::closeButton.explicitWidth = mx_internal::closeButton.explicitHeight = 16;
  203.             mx_internal::closeButton.focusEnabled = false;
  204.             mx_internal::closeButton.visible = false;
  205.             mx_internal::closeButton.enabled = enabled;
  206.             mx_internal::closeButton.addEventListener(MouseEvent.CLICK,closeButton_clickHandler);
  207.             titleBar.addChild(mx_internal::closeButton);
  208.             mx_internal::closeButton.owner = this;
  209.          }
  210.       }
  211.       
  212.       public function get constraintColumns() : Array
  213.       {
  214.          return _constraintColumns;
  215.       }
  216.       
  217.       override public function set cacheAsBitmap(param1:Boolean) : void
  218.       {
  219.          super.cacheAsBitmap = param1;
  220.          if(cacheAsBitmap && !mx_internal::contentPane && cachePolicy != UIComponentCachePolicy.OFF && getStyle("backgroundColor"))
  221.          {
  222.             createContentPane();
  223.             invalidateDisplayList();
  224.          }
  225.       }
  226.       
  227.       override public function createComponentsFromDescriptors(param1:Boolean = true) : void
  228.       {
  229.          var _loc3_:Object = null;
  230.          super.createComponentsFromDescriptors();
  231.          if(numChildren == 0)
  232.          {
  233.             setControlBar(null);
  234.             return;
  235.          }
  236.          var _loc2_:IUIComponent = IUIComponent(getChildAt(numChildren - 1));
  237.          if(_loc2_ is ControlBar)
  238.          {
  239.             _loc3_ = _loc2_.document;
  240.             if(mx_internal::contentPane)
  241.             {
  242.                mx_internal::contentPane.removeChild(DisplayObject(_loc2_));
  243.             }
  244.             else
  245.             {
  246.                removeChild(DisplayObject(_loc2_));
  247.             }
  248.             _loc2_.document = _loc3_;
  249.             rawChildren.addChild(DisplayObject(_loc2_));
  250.             setControlBar(_loc2_);
  251.          }
  252.          else
  253.          {
  254.             setControlBar(null);
  255.          }
  256.       }
  257.       
  258.       override protected function layoutChrome(param1:Number, param2:Number) : void
  259.       {
  260.          var _loc9_:Number = NaN;
  261.          var _loc10_:Graphics = null;
  262.          var _loc11_:Number = NaN;
  263.          var _loc12_:Number = NaN;
  264.          var _loc13_:Number = NaN;
  265.          var _loc14_:Number = NaN;
  266.          var _loc15_:Number = NaN;
  267.          var _loc16_:Number = NaN;
  268.          var _loc17_:Number = NaN;
  269.          var _loc18_:Number = NaN;
  270.          var _loc19_:Number = NaN;
  271.          var _loc20_:Number = NaN;
  272.          var _loc21_:Number = NaN;
  273.          super.layoutChrome(param1,param2);
  274.          var _loc3_:EdgeMetrics = EdgeMetrics.EMPTY;
  275.          var _loc4_:Number = getStyle("borderThickness");
  276.          if(getQualifiedClassName(mx_internal::border) == "mx.skins.halo::PanelSkin" && getStyle("borderStyle") != "default" && _loc4_)
  277.          {
  278.             _loc3_ = new EdgeMetrics(_loc4_,_loc4_,_loc4_,_loc4_);
  279.          }
  280.          var _loc5_:EdgeMetrics;
  281.          var _loc6_:Number = (_loc5_ = FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? borderMetrics : _loc3_).left;
  282.          var _loc7_:Number = _loc5_.top;
  283.          var _loc8_:Number;
  284.          if((_loc8_ = getHeaderHeight()) > 0 && height >= _loc8_)
  285.          {
  286.             _loc9_ = param1 - _loc5_.left - _loc5_.right;
  287.             showTitleBar(true);
  288.             titleBar.mouseChildren = true;
  289.             titleBar.mouseEnabled = true;
  290.             (_loc10_ = titleBar.graphics).clear();
  291.             _loc10_.beginFill(16777215,0);
  292.             _loc10_.drawRect(0,0,_loc9_,_loc8_);
  293.             _loc10_.endFill();
  294.             titleBar.move(_loc6_,_loc7_);
  295.             titleBar.setActualSize(_loc9_,_loc8_);
  296.             mx_internal::titleBarBackground.move(0,0);
  297.             IFlexDisplayObject(mx_internal::titleBarBackground).setActualSize(_loc9_,_loc8_);
  298.             mx_internal::closeButton.visible = mx_internal::_showCloseButton;
  299.             if(mx_internal::_showCloseButton)
  300.             {
  301.                mx_internal::closeButton.setActualSize(mx_internal::closeButton.getExplicitOrMeasuredWidth(),mx_internal::closeButton.getExplicitOrMeasuredHeight());
  302.                mx_internal::closeButton.move(param1 - _loc6_ - _loc5_.right - 10 - mx_internal::closeButton.getExplicitOrMeasuredWidth(),(_loc8_ - mx_internal::closeButton.getExplicitOrMeasuredHeight()) / 2);
  303.             }
  304.             _loc11_ = 10;
  305.             _loc12_ = 10;
  306.             if(mx_internal::titleIconObject)
  307.             {
  308.                _loc13_ = mx_internal::titleIconObject.height;
  309.                _loc14_ = (_loc8_ - _loc13_) / 2;
  310.                mx_internal::titleIconObject.move(_loc11_,_loc14_);
  311.                _loc11_ += mx_internal::titleIconObject.width + 4;
  312.             }
  313.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  314.             {
  315.                _loc13_ = titleTextField.nonZeroTextHeight;
  316.             }
  317.             else
  318.             {
  319.                _loc13_ = titleTextField.getUITextFormat().measureText(titleTextField.text).height;
  320.             }
  321.             _loc14_ = (_loc8_ - _loc13_) / 2;
  322.             _loc15_ = _loc5_.left + _loc5_.right;
  323.             titleTextField.move(_loc11_,_loc14_ - 1);
  324.             titleTextField.setActualSize(Math.max(0,param1 - _loc11_ - _loc12_ - _loc15_),_loc13_ + UITextField.TEXT_HEIGHT_PADDING);
  325.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  326.             {
  327.                _loc13_ = statusTextField.textHeight;
  328.             }
  329.             else
  330.             {
  331.                _loc13_ = statusTextField.text != "" ? Number(statusTextField.getUITextFormat().measureText(statusTextField.text).height) : Number(0);
  332.             }
  333.             _loc14_ = (_loc8_ - _loc13_) / 2;
  334.             _loc16_ = param1 - _loc12_ - 4 - _loc15_ - statusTextField.textWidth;
  335.             if(mx_internal::_showCloseButton)
  336.             {
  337.                _loc16_ -= mx_internal::closeButton.getExplicitOrMeasuredWidth() + 4;
  338.             }
  339.             statusTextField.move(_loc16_,_loc14_ - 1);
  340.             statusTextField.setActualSize(statusTextField.textWidth + 8,statusTextField.textHeight + UITextField.TEXT_HEIGHT_PADDING);
  341.             _loc17_ = titleTextField.x + titleTextField.textWidth + 8;
  342.             if(statusTextField.x < _loc17_)
  343.             {
  344.                statusTextField.width = Math.max(statusTextField.width - (_loc17_ - statusTextField.x),0);
  345.                statusTextField.x = _loc17_;
  346.             }
  347.          }
  348.          else if(titleBar)
  349.          {
  350.             showTitleBar(false);
  351.             titleBar.mouseChildren = false;
  352.             titleBar.mouseEnabled = false;
  353.          }
  354.          if(controlBar)
  355.          {
  356.             _loc18_ = controlBar.x;
  357.             _loc19_ = controlBar.y;
  358.             _loc20_ = controlBar.width;
  359.             _loc21_ = controlBar.height;
  360.             controlBar.setActualSize(param1 - (_loc5_.left + _loc5_.right),controlBar.getExplicitOrMeasuredHeight());
  361.             controlBar.move(_loc5_.left,param2 - _loc5_.bottom - controlBar.getExplicitOrMeasuredHeight());
  362.             if(controlBar.includeInLayout)
  363.             {
  364.                controlBar.visible = controlBar.y >= _loc5_.top;
  365.             }
  366.             if(_loc18_ != controlBar.x || _loc19_ != controlBar.y || _loc20_ != controlBar.width || _loc21_ != controlBar.height)
  367.             {
  368.                invalidateDisplayList();
  369.             }
  370.          }
  371.       }
  372.       
  373.       public function set layout(param1:String) : void
  374.       {
  375.          if(_layout != param1)
  376.          {
  377.             _layout = param1;
  378.             if(layoutObject)
  379.             {
  380.                layoutObject.target = null;
  381.             }
  382.             if(_layout == ContainerLayout.ABSOLUTE)
  383.             {
  384.                layoutObject = new CanvasLayout();
  385.             }
  386.             else
  387.             {
  388.                layoutObject = new BoxLayout();
  389.                if(_layout == ContainerLayout.VERTICAL)
  390.                {
  391.                   BoxLayout(layoutObject).direction = BoxDirection.VERTICAL;
  392.                }
  393.                else
  394.                {
  395.                   BoxLayout(layoutObject).direction = BoxDirection.HORIZONTAL;
  396.                }
  397.             }
  398.             if(layoutObject)
  399.             {
  400.                layoutObject.target = this;
  401.             }
  402.             invalidateSize();
  403.             invalidateDisplayList();
  404.             dispatchEvent(new Event("layoutChanged"));
  405.          }
  406.       }
  407.       
  408.       public function get constraintRows() : Array
  409.       {
  410.          return _constraintRows;
  411.       }
  412.       
  413.       [Bindable("titleChanged")]
  414.       public function get title() : String
  415.       {
  416.          return _title;
  417.       }
  418.       
  419.       mx_internal function getTitleTextField() : IUITextField
  420.       {
  421.          return titleTextField;
  422.       }
  423.       
  424.       mx_internal function createStatusTextField(param1:int) : void
  425.       {
  426.          var _loc2_:String = null;
  427.          if(titleBar && !statusTextField)
  428.          {
  429.             statusTextField = IUITextField(createInFontContext(UITextField));
  430.             statusTextField.selectable = false;
  431.             if(param1 == -1)
  432.             {
  433.                titleBar.addChild(DisplayObject(statusTextField));
  434.             }
  435.             else
  436.             {
  437.                titleBar.addChildAt(DisplayObject(statusTextField),param1);
  438.             }
  439.             _loc2_ = getStyle("statusStyleName");
  440.             statusTextField.styleName = _loc2_;
  441.             statusTextField.text = status;
  442.             statusTextField.enabled = enabled;
  443.          }
  444.       }
  445.       
  446.       public function get fontContext() : IFlexModuleFactory
  447.       {
  448.          return moduleFactory;
  449.       }
  450.       
  451.       override protected function measure() : void
  452.       {
  453.          var _loc6_:Number = NaN;
  454.          super.measure();
  455.          layoutObject.measure();
  456.          var _loc1_:Rectangle = measureHeaderText();
  457.          var _loc2_:Number = _loc1_.width;
  458.          var _loc3_:Number = _loc1_.height;
  459.          var _loc4_:EdgeMetrics = FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? borderMetrics : EdgeMetrics.EMPTY;
  460.          _loc2_ += _loc4_.left + _loc4_.right;
  461.          var _loc5_:Number = 5;
  462.          _loc2_ += _loc5_ * 2;
  463.          if(mx_internal::titleIconObject)
  464.          {
  465.             _loc2_ += mx_internal::titleIconObject.width;
  466.          }
  467.          if(mx_internal::closeButton)
  468.          {
  469.             _loc2_ += mx_internal::closeButton.getExplicitOrMeasuredWidth() + 6;
  470.          }
  471.          measuredMinWidth = Math.max(_loc2_,measuredMinWidth);
  472.          measuredWidth = Math.max(_loc2_,measuredWidth);
  473.          if(controlBar && controlBar.includeInLayout)
  474.          {
  475.             _loc6_ = controlBar.getExplicitOrMeasuredWidth() + _loc4_.left + _loc4_.right;
  476.             measuredWidth = Math.max(measuredWidth,_loc6_);
  477.          }
  478.       }
  479.       
  480.       mx_internal function getControlBar() : IUIComponent
  481.       {
  482.          return controlBar;
  483.       }
  484.       
  485.       override public function get viewMetrics() : EdgeMetrics
  486.       {
  487.          var _loc2_:EdgeMetrics = null;
  488.          var _loc3_:Number = NaN;
  489.          var _loc4_:Number = NaN;
  490.          var _loc5_:Number = NaN;
  491.          var _loc6_:Number = NaN;
  492.          var _loc7_:Number = NaN;
  493.          var _loc8_:Number = NaN;
  494.          var _loc1_:EdgeMetrics = super.viewMetrics;
  495.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  496.          {
  497.             if(!panelViewMetrics)
  498.             {
  499.                panelViewMetrics = new EdgeMetrics(0,0,0,0);
  500.             }
  501.             _loc1_ = panelViewMetrics;
  502.             _loc2_ = super.viewMetrics;
  503.             _loc3_ = getStyle("borderThickness");
  504.             _loc4_ = getStyle("borderThicknessLeft");
  505.             _loc5_ = getStyle("borderThicknessTop");
  506.             _loc6_ = getStyle("borderThicknessRight");
  507.             _loc7_ = getStyle("borderThicknessBottom");
  508.             _loc1_.left = _loc2_.left + (!!isNaN(_loc4_) ? _loc3_ : _loc4_);
  509.             _loc1_.top = _loc2_.top + (!!isNaN(_loc5_) ? _loc3_ : _loc5_);
  510.             _loc1_.right = _loc2_.right + (!!isNaN(_loc6_) ? _loc3_ : _loc6_);
  511.             _loc1_.bottom = _loc2_.bottom + (!!isNaN(_loc7_) ? (controlBar && !isNaN(_loc5_) ? _loc5_ : (!!isNaN(_loc4_) ? _loc3_ : _loc4_)) : _loc7_);
  512.             _loc8_ = getHeaderHeight();
  513.             if(!isNaN(_loc8_))
  514.             {
  515.                _loc1_.top += _loc8_;
  516.             }
  517.             if(controlBar && controlBar.includeInLayout)
  518.             {
  519.                _loc1_.bottom += controlBar.getExplicitOrMeasuredHeight();
  520.             }
  521.          }
  522.          return _loc1_;
  523.       }
  524.       
  525.       private function measureHeaderText() : Rectangle
  526.       {
  527.          var _loc3_:UITextFormat = null;
  528.          var _loc4_:TextLineMetrics = null;
  529.          var _loc1_:Number = 20;
  530.          var _loc2_:Number = 14;
  531.          if(titleTextField && titleTextField.text)
  532.          {
  533.             titleTextField.validateNow();
  534.             _loc3_ = titleTextField.getUITextFormat();
  535.             _loc1_ = (_loc4_ = _loc3_.measureText(titleTextField.text,false)).width;
  536.             _loc2_ = _loc4_.height;
  537.          }
  538.          if(statusTextField && statusTextField.text)
  539.          {
  540.             statusTextField.validateNow();
  541.             _loc3_ = statusTextField.getUITextFormat();
  542.             _loc4_ = _loc3_.measureText(statusTextField.text,false);
  543.             _loc1_ = Math.max(_loc1_,_loc4_.width);
  544.             _loc2_ = Math.max(_loc2_,_loc4_.height);
  545.          }
  546.          return new Rectangle(0,0,Math.round(_loc1_),Math.round(_loc2_));
  547.       }
  548.       
  549.       mx_internal function createTitleTextField(param1:int) : void
  550.       {
  551.          var _loc2_:String = null;
  552.          if(!titleTextField)
  553.          {
  554.             titleTextField = IUITextField(createInFontContext(UITextField));
  555.             titleTextField.selectable = false;
  556.             if(param1 == -1)
  557.             {
  558.                titleBar.addChild(DisplayObject(titleTextField));
  559.             }
  560.             else
  561.             {
  562.                titleBar.addChildAt(DisplayObject(titleTextField),param1);
  563.             }
  564.             _loc2_ = getStyle("titleStyleName");
  565.             titleTextField.styleName = _loc2_;
  566.             titleTextField.text = title;
  567.             titleTextField.enabled = enabled;
  568.          }
  569.       }
  570.       
  571.       private function closeButton_clickHandler(param1:MouseEvent) : void
  572.       {
  573.          dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
  574.       }
  575.       
  576.       private function setControlBar(param1:IUIComponent) : void
  577.       {
  578.          if(param1 == controlBar)
  579.          {
  580.             return;
  581.          }
  582.          controlBar = param1;
  583.          if(!checkedForAutoSetRoundedCorners)
  584.          {
  585.             checkedForAutoSetRoundedCorners = true;
  586.             autoSetRoundedCorners = !!styleDeclaration ? styleDeclaration.getStyle("roundedBottomCorners") === undefined : true;
  587.          }
  588.          if(autoSetRoundedCorners)
  589.          {
  590.             setStyle("roundedBottomCorners",controlBar != null);
  591.          }
  592.          var _loc2_:String = getStyle("controlBarStyleName");
  593.          if(_loc2_ && controlBar is ISimpleStyleClient)
  594.          {
  595.             ISimpleStyleClient(controlBar).styleName = _loc2_;
  596.          }
  597.          if(controlBar)
  598.          {
  599.             controlBar.enabled = enabled;
  600.          }
  601.          if(controlBar is IAutomationObject)
  602.          {
  603.             IAutomationObject(controlBar).showInAutomationHierarchy = false;
  604.          }
  605.          invalidateViewMetricsAndPadding();
  606.          invalidateSize();
  607.          invalidateDisplayList();
  608.       }
  609.       
  610.       protected function get closeButtonStyleFilters() : Object
  611.       {
  612.          return _closeButtonStyleFilters;
  613.       }
  614.       
  615.       public function set constraintColumns(param1:Array) : void
  616.       {
  617.          var _loc2_:int = 0;
  618.          var _loc3_:int = 0;
  619.          if(param1 != _constraintColumns)
  620.          {
  621.             _loc2_ = param1.length;
  622.             _loc3_ = 0;
  623.             while(_loc3_ < _loc2_)
  624.             {
  625.                ConstraintColumn(param1[_loc3_]).container = this;
  626.                _loc3_++;
  627.             }
  628.             _constraintColumns = param1;
  629.             invalidateSize();
  630.             invalidateDisplayList();
  631.          }
  632.       }
  633.       
  634.       override public function set enabled(param1:Boolean) : void
  635.       {
  636.          super.enabled = param1;
  637.          if(titleTextField)
  638.          {
  639.             titleTextField.enabled = param1;
  640.          }
  641.          if(statusTextField)
  642.          {
  643.             statusTextField.enabled = param1;
  644.          }
  645.          if(controlBar)
  646.          {
  647.             controlBar.enabled = param1;
  648.          }
  649.          if(mx_internal::closeButton)
  650.          {
  651.             mx_internal::closeButton.enabled = param1;
  652.          }
  653.       }
  654.       
  655.       override public function get baselinePosition() : Number
  656.       {
  657.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  658.          {
  659.             return super.baselinePosition;
  660.          }
  661.          if(!validateBaselinePosition())
  662.          {
  663.             return NaN;
  664.          }
  665.          return titleBar.y + titleTextField.y + titleTextField.baselinePosition;
  666.       }
  667.       
  668.       protected function stopDragging() : void
  669.       {
  670.          systemManager.removeEventListener(MouseEvent.MOUSE_MOVE,systemManager_mouseMoveHandler,true);
  671.          systemManager.removeEventListener(MouseEvent.MOUSE_UP,systemManager_mouseUpHandler,true);
  672.          systemManager.stage.removeEventListener(Event.MOUSE_LEAVE,stage_mouseLeaveHandler);
  673.          regX = NaN;
  674.          regY = NaN;
  675.       }
  676.       
  677.       private function titleBar_mouseDownHandler(param1:MouseEvent) : void
  678.       {
  679.          if(param1.target == mx_internal::closeButton)
  680.          {
  681.             return;
  682.          }
  683.          if(enabled && isPopUp && isNaN(regX))
  684.          {
  685.             startDragging(param1);
  686.          }
  687.       }
  688.       
  689.       override mx_internal function get usePadding() : Boolean
  690.       {
  691.          return layout != ContainerLayout.ABSOLUTE;
  692.       }
  693.       
  694.       override protected function initializeAccessibility() : void
  695.       {
  696.          if(Panel.createAccessibilityImplementation != null)
  697.          {
  698.             Panel.createAccessibilityImplementation(this);
  699.          }
  700.       }
  701.       
  702.       protected function getHeaderHeight() : Number
  703.       {
  704.          var _loc1_:Number = getStyle("headerHeight");
  705.          if(isNaN(_loc1_))
  706.          {
  707.             _loc1_ = measureHeaderText().height + HEADER_PADDING;
  708.          }
  709.          return _loc1_;
  710.       }
  711.       
  712.       public function set constraintRows(param1:Array) : void
  713.       {
  714.          var _loc2_:int = 0;
  715.          var _loc3_:int = 0;
  716.          if(param1 != _constraintRows)
  717.          {
  718.             _loc2_ = param1.length;
  719.             _loc3_ = 0;
  720.             while(_loc3_ < _loc2_)
  721.             {
  722.                ConstraintRow(param1[_loc3_]).container = this;
  723.                _loc3_++;
  724.             }
  725.             _constraintRows = param1;
  726.             invalidateSize();
  727.             invalidateDisplayList();
  728.          }
  729.       }
  730.       
  731.       public function set title(param1:String) : void
  732.       {
  733.          _title = param1;
  734.          _titleChanged = true;
  735.          invalidateProperties();
  736.          invalidateSize();
  737.          invalidateViewMetricsAndPadding();
  738.          dispatchEvent(new Event("titleChanged"));
  739.       }
  740.       
  741.       private function showTitleBar(param1:Boolean) : void
  742.       {
  743.          var _loc4_:DisplayObject = null;
  744.          titleBar.visible = param1;
  745.          var _loc2_:int = titleBar.numChildren;
  746.          var _loc3_:int = 0;
  747.          while(_loc3_ < _loc2_)
  748.          {
  749.             (_loc4_ = titleBar.getChildAt(_loc3_)).visible = param1;
  750.             _loc3_++;
  751.          }
  752.       }
  753.       
  754.       override public function styleChanged(param1:String) : void
  755.       {
  756.          var _loc3_:String = null;
  757.          var _loc4_:String = null;
  758.          var _loc5_:String = null;
  759.          var _loc6_:Class = null;
  760.          var _loc7_:IStyleClient = null;
  761.          var _loc8_:ISimpleStyleClient = null;
  762.          var _loc2_:Boolean = !param1 || param1 == "styleName";
  763.          super.styleChanged(param1);
  764.          if(_loc2_ || param1 == "titleStyleName")
  765.          {
  766.             if(titleTextField)
  767.             {
  768.                _loc3_ = getStyle("titleStyleName");
  769.                titleTextField.styleName = _loc3_;
  770.             }
  771.          }
  772.          if(_loc2_ || param1 == "statusStyleName")
  773.          {
  774.             if(statusTextField)
  775.             {
  776.                _loc4_ = getStyle("statusStyleName");
  777.                statusTextField.styleName = _loc4_;
  778.             }
  779.          }
  780.          if(_loc2_ || param1 == "controlBarStyleName")
  781.          {
  782.             if(controlBar && controlBar is ISimpleStyleClient)
  783.             {
  784.                _loc5_ = getStyle("controlBarStyleName");
  785.                ISimpleStyleClient(controlBar).styleName = _loc5_;
  786.             }
  787.          }
  788.          if(_loc2_ || param1 == "titleBackgroundSkin")
  789.          {
  790.             if(titleBar)
  791.             {
  792.                if(_loc6_ = getStyle("titleBackgroundSkin"))
  793.                {
  794.                   if(mx_internal::titleBarBackground)
  795.                   {
  796.                      titleBar.removeChild(DisplayObject(mx_internal::titleBarBackground));
  797.                      titleBarBackground = null;
  798.                   }
  799.                   titleBarBackground = new _loc6_();
  800.                   if(_loc7_ = mx_internal::titleBarBackground as IStyleClient)
  801.                   {
  802.                      _loc7_.setStyle("backgroundImage",undefined);
  803.                   }
  804.                   if(_loc8_ = mx_internal::titleBarBackground as ISimpleStyleClient)
  805.                   {
  806.                      _loc8_.styleName = this;
  807.                   }
  808.                   titleBar.addChildAt(DisplayObject(mx_internal::titleBarBackground),0);
  809.                }
  810.             }
  811.          }
  812.       }
  813.       
  814.       mx_internal function getStatusTextField() : IUITextField
  815.       {
  816.          return statusTextField;
  817.       }
  818.       
  819.       public function set fontContext(param1:IFlexModuleFactory) : void
  820.       {
  821.          this.moduleFactory = param1;
  822.       }
  823.       
  824.       override protected function commitProperties() : void
  825.       {
  826.          var _loc1_:int = 0;
  827.          super.commitProperties();
  828.          if(hasFontContextChanged())
  829.          {
  830.             if(titleTextField)
  831.             {
  832.                _loc1_ = titleBar.getChildIndex(DisplayObject(titleTextField));
  833.                removeTitleTextField();
  834.                createTitleTextField(_loc1_);
  835.                _titleChanged = true;
  836.             }
  837.             if(statusTextField)
  838.             {
  839.                _loc1_ = titleBar.getChildIndex(DisplayObject(statusTextField));
  840.                removeStatusTextField();
  841.                createStatusTextField(_loc1_);
  842.                _statusChanged = true;
  843.             }
  844.          }
  845.          if(_titleChanged)
  846.          {
  847.             _titleChanged = false;
  848.             titleTextField.text = _title;
  849.             if(initialized)
  850.             {
  851.                layoutChrome(unscaledWidth,unscaledHeight);
  852.             }
  853.          }
  854.          if(_titleIconChanged)
  855.          {
  856.             _titleIconChanged = false;
  857.             if(mx_internal::titleIconObject)
  858.             {
  859.                titleBar.removeChild(DisplayObject(mx_internal::titleIconObject));
  860.                titleIconObject = null;
  861.             }
  862.             if(_titleIcon)
  863.             {
  864.                titleIconObject = new _titleIcon();
  865.                titleBar.addChild(DisplayObject(mx_internal::titleIconObject));
  866.             }
  867.             if(initialized)
  868.             {
  869.                layoutChrome(unscaledWidth,unscaledHeight);
  870.             }
  871.          }
  872.          if(_statusChanged)
  873.          {
  874.             _statusChanged = false;
  875.             statusTextField.text = _status;
  876.             if(initialized)
  877.             {
  878.                layoutChrome(unscaledWidth,unscaledHeight);
  879.             }
  880.          }
  881.       }
  882.       
  883.       protected function startDragging(param1:MouseEvent) : void
  884.       {
  885.          regX = param1.stageX - x;
  886.          regY = param1.stageY - y;
  887.          systemManager.addEventListener(MouseEvent.MOUSE_MOVE,systemManager_mouseMoveHandler,true);
  888.          systemManager.addEventListener(MouseEvent.MOUSE_UP,systemManager_mouseUpHandler,true);
  889.          systemManager.stage.addEventListener(Event.MOUSE_LEAVE,stage_mouseLeaveHandler);
  890.       }
  891.       
  892.       mx_internal function removeStatusTextField() : void
  893.       {
  894.          if(titleBar && statusTextField)
  895.          {
  896.             titleBar.removeChild(DisplayObject(statusTextField));
  897.             statusTextField = null;
  898.          }
  899.       }
  900.       
  901.       private function stage_mouseLeaveHandler(param1:Event) : void
  902.       {
  903.          if(!isNaN(regX))
  904.          {
  905.             stopDragging();
  906.          }
  907.       }
  908.       
  909.       public function set status(param1:String) : void
  910.       {
  911.          _status = param1;
  912.          _statusChanged = true;
  913.          invalidateProperties();
  914.          dispatchEvent(new Event("statusChanged"));
  915.       }
  916.       
  917.       [Bindable("titleIconChanged")]
  918.       public function get titleIcon() : Class
  919.       {
  920.          return _titleIcon;
  921.       }
  922.       
  923.       [Bindable("statusChanged")]
  924.       public function get status() : String
  925.       {
  926.          return _status;
  927.       }
  928.       
  929.       private function systemManager_mouseMoveHandler(param1:MouseEvent) : void
  930.       {
  931.          param1.stopImmediatePropagation();
  932.          move(param1.stageX - regX,param1.stageY - regY);
  933.       }
  934.       
  935.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  936.       {
  937.          super.updateDisplayList(param1,param2);
  938.          layoutObject.updateDisplayList(param1,param2);
  939.          if(mx_internal::border)
  940.          {
  941.             mx_internal::border.visible = true;
  942.          }
  943.          titleBar.visible = true;
  944.       }
  945.       
  946.       mx_internal function removeTitleTextField() : void
  947.       {
  948.          if(titleBar && titleTextField)
  949.          {
  950.             titleBar.removeChild(DisplayObject(titleTextField));
  951.             titleTextField = null;
  952.          }
  953.       }
  954.       
  955.       public function set titleIcon(param1:Class) : void
  956.       {
  957.          _titleIcon = param1;
  958.          _titleIconChanged = true;
  959.          invalidateProperties();
  960.          invalidateSize();
  961.          dispatchEvent(new Event("titleIconChanged"));
  962.       }
  963.    }
  964. }
  965.